#!/usr/bin/env php
<?php
define('PATH_BASE',__DIR__ . '/');
define('PATH_COMPONENT',PATH_BASE . '/components/');
define('PATH_CONFIG',PATH_BASE . 'config/');
define('PATH_RUNTIME',PATH_BASE . 'runtimes/');
define('DEBUG', false);

require(PATH_COMPONENT.'register.php');

if ($argc < 1) {
	die('arguments must two more.');
}

$i = 0;
while ($i < $argc) {
	if (strpos($argv[$i], '/') !== false) {
		list($controller, $action) = explode('/', $argv[$i]);
		break;
	}
	++$i;
}

if (empty($controller) || empty($action)) {
	die('controller or action is not exist');
}

$validController = 'console\\' . libs\Util::strToCamel($controller) . 'Controller';
$validAction     = 'action' . libs\Util::strToCamel($action);

(new $validController)->$validAction();

